package com.google.project.server.entity;

import java.io.Serializable;

import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.project.shared.DocumentDTO;

@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
public class Document implements Serializable {

	private static final long serialVersionUID = 1L;
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	@Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
	private String id;
	@Persistent
	private String forId;
	@Persistent
	private String type;
	@Persistent
	private String url;
	@Persistent
	private Long createdOnDate;
	@Persistent
	private String description;
	@Persistent
	private String documentName;
	@Persistent
	private String blobKey;

	public DocumentDTO toDTO() {
		DocumentDTO data = new DocumentDTO();
		data.setId(id);
		data.setForId(forId);
		data.setType(type);
		data.setUrl(url);
		data.setCreatedOnDate(createdOnDate);
		data.setDescription(description);
		data.setDocumentName(documentName);
		data.setBlobKey(blobKey);
		return data;
	}
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getForId() {
		return forId;
	}

	public void setForId(String forId) {
		this.forId = forId;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public Long getCreatedOnDate() {
		return createdOnDate;
	}

	public void setCreatedOnDate(Long createdOnDate) {
		this.createdOnDate = createdOnDate;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getDocumentName() {
		return documentName;
	}

	public void setDocumentName(String documentName) {
		this.documentName = documentName;
	}

	public String getBlobKey() {
		return blobKey;
	}

	public void setBlobKey(String blobKey) {
		this.blobKey = blobKey;
	}

}
